package com.zhijian.medical.controller;

import com.zhijian.medical.annotation.Response;
import com.zhijian.medical.entity.vo.request.MeetingDataSaveOrUpdateVo;
import com.zhijian.medical.entity.vo.response.MeetingDataVo;
import com.zhijian.medical.service.MeetingDataService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * 会议表格数据 控制层
 *
 * @author auto
 * @version 1.0
 * @date 2024-01-10 16:58:39
 */
@Slf4j
@Controller
@Api(tags = "会议表格数据")
public class MeetingDataController {

    @Autowired
    private MeetingDataService service;

    /**
     * 新增or修改提交
     *
     * @param param
     * @return
     */
    @Response
    @PostMapping("/meeting/data")
    @ApiOperation("新增or修改提交")
    public boolean saveOrUpdate(@RequestBody MeetingDataSaveOrUpdateVo param) {
        log.info("{} - {}| insert info", this.getClass().getSimpleName(), param);
        return service.saveOrUpdate(param);
    }

    /**
     * 根据会议ID查询
     *
     * @param meetingId
     * @return
     */
    @Response
    @GetMapping("/meeting/data/{meetingId}")
    @ApiOperation("根据会议ID查询")
    public MeetingDataVo selectByMeetingId(@PathVariable("meetingId") Long meetingId) {
        log.info("{} - {}| query info", this.getClass().getSimpleName(), meetingId);
        return service.selectVoByMeetingId(meetingId);
    }

}